//
//  FPNavBarView.m
//  FilmParadise
//
//  Created by lanou3g on 15/7/13.
//  Copyright (c) 2015年 DLYgroup. All rights reserved.
//

#import "FPNavBarView.h"

@implementation FPNavBarView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self creatButton];
         self.lineView = [[UIView alloc]initWithFrame:CGRectMake(- 10,43,kScreenWidth/4, 2)];
        self.lineView.backgroundColor = [UIColor redColor];
        [self addSubview:_lineView];
    }
    return self;
}

- (void)creatButton
{
    
    self.newsButton = [UIButton buttonWithType:UIButtonTypeSystem];
    self.newsButton.frame = CGRectMake(kImageW(-10), 0, kScreenWidth/4,  kImageH(40));
    self.newsButton.tag = 100;
    [self.newsButton setTitle:@"新闻" forState:UIControlStateNormal];
    [self.newsButton setTintColor:[UIColor whiteColor]];
    [self addSubview:_newsButton];
    
    self.prevueButton = [UIButton buttonWithType:UIButtonTypeSystem];
    self.prevueButton.frame = CGRectMake(kImageW(-10) + kScreenWidth/4, 0, kScreenWidth/4,  kImageH(40));
    [self.prevueButton setTitle:@"预告片" forState:UIControlStateNormal];
    [self.prevueButton setTintColor:[UIColor whiteColor]];

    self.prevueButton.tag = 101;
    [self addSubview:_prevueButton];
    
    self.topButton = [UIButton buttonWithType:UIButtonTypeSystem];
    self.topButton.frame = CGRectMake(kImageW(-10)+kScreenWidth/4 * 2, 0, kScreenWidth/4,  kImageH(40));
    [self.topButton setTitle:@"排行榜" forState:UIControlStateNormal];
    [self.topButton setTintColor:[UIColor whiteColor]];

    self.topButton.tag = 102;
    [self addSubview:_topButton];
    
    self.filmCriticButton = [UIButton buttonWithType:UIButtonTypeSystem];
    self.filmCriticButton.frame = CGRectMake(kImageW(-10)+kScreenWidth/4 * 3, 0, kScreenWidth/4, kImageH(40));
    [self.filmCriticButton setTitle:@"影评" forState:UIControlStateNormal];
    [self.filmCriticButton setTintColor:[UIColor whiteColor]];

    self.filmCriticButton.tag = 103;
    [self addSubview:_filmCriticButton];
   
   
}

#pragma mark====================button添点击事件
- (void)addTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents
{
    [self.newsButton addTarget:target action:action forControlEvents:controlEvents];
    [self.prevueButton addTarget:target action:action forControlEvents:controlEvents];
    [self.topButton addTarget:target action:action forControlEvents:controlEvents];
    [self.filmCriticButton addTarget:target action:action forControlEvents:controlEvents];
    
}

@end
